<template>
  <div class="main">
    <el-container>
      <el-aside width="200px" style="overflow-x: hidden;">
        <asideNav></asideNav>
      </el-aside>
      <el-main>Main</el-main>
    </el-container>
  </div>
</template>
<script>
  import asideNav from 'components/nav/Nav.vue'
  import {login} from 'api/login'
  export default {
    components: {
      asideNav
    },
    data() {
      return {
        skinCssLink: ''
      }
    },
    created() {
      console.log(this.$store)
      if(location.hash != '#/login'){
        // this.checkLogin()
      }
      this.skinCssLink = document.createElement('link')
      this.skinCssLink.rel = 'stylesheet'
      this.skinCssLink.href = ""
      document.getElementsByTagName('head')[0].appendChild(this.skinCssLink)
    },
    computed: {
        // loginStatus(){
        //     return this.$store.state.user.isLogin
        // },
        skin(){
          return this.$store.state.user.skin
        },
    },
    watch : {
        // "loginStatus" : function(value, old){
        //     if(value == false || value == 'no'){
        //         this.$router.push({name : "login"})
        //     }
        // },
        skin : function(value, old) {
            const ts = new Date().getTime()
            if(this.skinCssLink){
                if(value == "blue"){
                    if (process.env.NODE_ENV === 'production') {
                        this.skinCssLink.href = '@/css/blueColor.css'+'?ts='+ts
                    } else {
                        this.skinCssLink.href = '@/css/blueColor.css'
                    }
                } else if (value == "orange") {
                    if (process.env.NODE_ENV === 'production') {
                        this.skinCssLink.href = '@/css/orangeColor.css'+'?ts='+ts
                    } else {
                        this.skinCssLink.href = '@/css/orangeColor.css'
                    }
                }
            }
        },
    },
    methods: {
    }
  }
</script>
<style lang="less" scoped>
</style>